#ifndef UDPSERVER_H
#define UDPSERVER_H

#include <QThread>
#include <QList>
#include <QString>
#include <QUdpSocket>

#include "udpparser.h"

class UDPServerThread:public QThread
{
  Q_OBJECT

public:
    UDPServerThread(QString ip, int port);
    ~UDPServerThread();
    int initServer();
    void closeServer();
    void stopCollector();

    bool isReady = false;
    bool isConnected = false;

protected:

    virtual void run() override;

private:
    QString ip;
    int port;
    QUdpSocket *udpSocket;
    UDPParser *parser;
//    QMutex lock;

signals:
    void parsedData(udpInfo info);
};


#endif // UDPSERVER_H
